#ifndef DATALOGGER_H_
#define DATALOGGER_H_

/*INCLUDES-------------------------------------------------------------------*/

#include "ses_eeprom.h"


/*DEFINES--------------------------------------------------------------------*/

/**Start address for data logging*/
#define DATALOGGER_START	0x1000

/**End address for data logging*/
#define DATALOGGER_END		0x1FFF

#define OFFSET_START		0x000
#define OFFSET_END			0xFFD
#define STRUCT_SIZE			4

#define FLAG_END_STRUCT		0
#define FLAG_LAST_STRUCT	1

/*  */
typedef struct {
	uint8_t temp_passes;
	uint8_t temperature[5];
	uint8_t avergTemp;

	uint8_t co2_passes;
	uint16_t co2[5];
	uint16_t avergCO2;

	uint16_t stack_offset;

} data;


data DATA;

/*
 * initiate and set the memory ready to use
 * @return the adress of next byte to write
 */

void eeprom_init();

void save_to_eeprom();

void forceInit();

void getDataStruct();

void put_temperature(uint8_t temperature);

void put_co2(uint16_t co2);

uint32_t calc_abs_addr(uint16_t offset, int step);

void getAverageValues();


#endif /* DATALOGGER_H_ */
